import 'package:fate_blind_box/routes/page_route_names.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';

import 'state.dart';

class FriendDetailsLogic extends GetxController {
  final FriendDetailsState state = FriendDetailsState();
  @override
  void onInit() {
    // TODO: implement onInit
    super.onInit();
    state.scrollController.addListener(() {
      if(state.scrollController.position.pixels>=kToolbarHeight){
        state.clarity.value = 1.0;
      }else{
        state.clarity.value = state.scrollController.position.pixels/kToolbarHeight;
      }
    });
  }

  @override
  void onClose() {
    // TODO: implement onClose
    super.onClose();
    state.scrollController.dispose();
  }

  onCopy(String copy){
    Clipboard.setData(ClipboardData(text: copy));
    EasyLoading.showToast('复制成功');
  }

  void addMember(){
    Get.toNamed(PageRouteNames.applyAddFriendPage);
  }

  toRemake(){
    Get.toNamed(PageRouteNames.friendSetRemake,);
  }
}
